<extend name="Base/s4"/>


<block name="body">
    <div class="mainwrap">

        <div class="think-form">
            <div class="loginform">
                <div class="hd">
                    <strong>用户登录</strong><span>已有帐号？点击<a href="{:U('User/register')}">注册</a></span></div>

                <a rel="nofollow" href="{:C('DOMAIN')}" class="img"><img src="__IMG__/login-3.jpg" width='400'
                                                                         height='300'></a></div>
            <div class="login-other">
                <form class="form-horizontal login-user" action="{:U('User/login')}" id="loginform" name="user" method="post">
                <div class="control-group ">
                    <label class="control-label" for="username">用户名</label>

                    <div class="controls">
                        <em class="user glyphicon glyphicon-user"></em><input type="text" class="v_inp"
                                                                              id="inputusername" name="username">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputPassword">密码</label>

                    <div class="controls">
                        <em class="user glyphicon glyphicon-lock"></em> <input type="password" class="v_inp"
                                                                               id="inputpassword" name="password">
                    </div>
                    <div class="controls Validform_checktip text-warning"></div>
                </div>
                <input name="reffer" type="hidden" value="{$referr}">

                <div class="control-group">
                    <div class="controls">
                        <label class="checkbox">
                            <input type="checkbox"> 自动登陆
                        </label>
                        <br/>
                        <button type="submit" id="login_btn_cart" class="v_dark_btn">登 陆</button>
                    </div>
                </div>
                </form><p>合作网站账号登录：{:hook('SyncLogin')}
            </p></div>
        </div>

</block>


<block name="script">
	<script type="text/javascript">

    	$(document)
	    	.ajaxStart(function(){
	    		$("button:submit").addClass("log-in").attr("disabled", true);
	    	})
	    	.ajaxStop(function(){
	    		$("button:submit").removeClass("log-in").attr("disabled", false);
	    	});


    	$("#loginform").submit(function(){
    		var self = $(this);
    		$.post(self.attr("action"),self.serialize(),success,"json");
    		return false;

    		function success(data){
    			if(data.status){
    				window.location.href =data.url;
    			} else {
    				self.find(".Validform_checktip").text(data.info);
    				//刷新验证码
    				$(".reloadverify").click();
    			}
    		}
    	});

		$(function(){
			var verifyimg = $(".verifyimg").attr("src");
            $(".reloadverify").click(function(){
                if( verifyimg.indexOf('?')>0){
                    $(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
                }else{
                    $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
                }
            });
		});
	</script>
</block>
